package BC128_小乐乐计算求和;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int sum = 0;
        while (n > 0){
            int m = 1;
            for (int i = 1; i < n; i++){
                m *= i;
            }
            sum += m;
            n--;
        }

        System.out.println(sum);
    }
}
